//
//  HTLAIChanDetiklCell.swift
//  HIextractLicve
//
//  Created by HIextractLicve on 2024/12/9.
//

import UIKit

class HTLAIChanDetiklCell: UITableViewCell {
    var eachVioViewHTLC:THLCNOrBUTTOn?
    var mindfulnessPageHTL:THLCNPageControll?
    var journeyHTLC:UIView?
    
    
    let duihuaLblHTLC = UILabel.init()
    private let duihuaBbackHTLC = UIView.init()
    var mindfulness:Set<Int>?
    var suggestion:Set<String>?
    var  professionals:Set<CGFloat>?
    var exchangeHTLC:[String:Array<Dictionary<String,String>>]?

    private  let avatoerHTLC = UIImageView()
    
    func updateCell_HTLCCellDiolog(stressdescHTL:Set<Int>,isfghjtBool:Bool) {
       

        
        if isfghjtBool == true{
            avatoerHTLC.isHidden = true
            duihuaBbackHTLC.backgroundColor = UIColor(red: 0.95, green: 0.08, blue: 0.5, alpha: 1)
            duihuaLblHTLC.textColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1)
           
           
            duihuaLblHTLC.snp.remakeConstraints { make in
                make.leading.trailing.equalToSuperview().inset(16.xHTL)
                make.top.bottom.equalToSuperview().inset(16.xHTL)
            }
            
            
            duihuaBbackHTLC.snp.remakeConstraints { make in
                make.width.lessThanOrEqualTo(274.xHTL)
                make.trailing.equalToSuperview().offset(-16.xHTL)
                make.top.bottom.equalToSuperview().inset(18.xHTL)
               
                make.width.greaterThanOrEqualTo(75.xHTL)
            }
            
            
            
        }else{
            avatoerHTLC.isHidden = false
            duihuaBbackHTLC.backgroundColor = .white
            duihuaLblHTLC.textColor = UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 1)
          
            
            duihuaLblHTLC.snp.remakeConstraints { make in
                make.leading.trailing.equalToSuperview().inset(16.xHTL)
                make.top.bottom.equalToSuperview().inset(16.xHTL)
            }
         
           
                duihuaBbackHTLC.snp.remakeConstraints { make in
                    make.width.lessThanOrEqualTo(274.xHTL)
                    make.leading.equalTo(avatoerHTLC.snp.trailing).offset(8.xHTL)
                    make.top.bottom.equalToSuperview().inset(16.xHTL)
                   
                    make.width.greaterThanOrEqualTo(75.xHTL)
                
                
            }
            
           
            
            
        }
    }
    
  
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backgroundColor = .clear
        contentView.addSubview(avatoerHTLC)
        contentView.addSubview(duihuaBbackHTLC)
        
        avatoerHTLC.layer.cornerRadius = 22.xHTL
        avatoerHTLC.image = UIImage(named: "AiRoberter")
        avatoerHTLC.layer.masksToBounds = true
        avatoerHTLC.contentMode = .scaleAspectFill
        
        duihuaBbackHTLC.addSubview(duihuaLblHTLC)
        
        duihuaLblHTLC.font = UIFont(name: "Trebuchet MS", size: 15)
        duihuaLblHTLC.textColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1)
        duihuaLblHTLC.numberOfLines  = 0
        duihuaBbackHTLC.backgroundColor =  UIColor(red: 0.95, green: 0.08, blue: 0.5, alpha: 1)
        duihuaBbackHTLC.layer.cornerRadius = 18
        duihuaBbackHTLC.layer.masksToBounds = true
        if self.contentView.isHidden == true {
            journeyHTLC?.alpha = 1
            journeyHTLC?.layer.cornerRadius = 12
        }
        journeyHTLC?.backgroundColor = UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 0.01)

        eachVioViewHTLC = THLCNOrBUTTOn.init()
        eachVioViewHTLC?.setTitle("anchors", for: .normal)
        if journeyHTLC != nil {
            journeyHTLC?.addSubview(eachVioViewHTLC ?? THLCNOrBUTTOn.init())
            contentView.addSubview(journeyHTLC!)
        }

        mindfulnessPageHTL = THLCNPageControll()
        mindfulnessPageHTL?.numberOfPages = 1
        mindfulnessPageHTL?.backgroundColor = UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 0.01)
        mindfulnessPageHTL?.tintColor = UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 0.01)
        mindfulnessPageHTL?.sizeToFit()

        if journeyHTLC != nil {
            journeyHTLC?.addSubview(mindfulnessPageHTL ?? THLCNPageControll.init())
           
        }
        duihuaBbackHTLC.contentMode = .scaleAspectFill
        
        
        
        avatoerHTLC.snp.makeConstraints { make in
            make.width.height.equalTo(44.xHTL)
            make.top.equalToSuperview().offset(15.xHTL)
            make.leading.equalToSuperview().offset(14.xHTL)
        }
        
        duihuaBbackHTLC.snp.makeConstraints { make in
            make.width.lessThanOrEqualTo(274.xHTL)
            make.leading.equalTo(avatoerHTLC.snp.trailing).offset(8.xHTL)
            make.top.bottom.equalToSuperview().inset(18.xHTL)
            make.width.greaterThanOrEqualTo(75.xHTL)
        }
        mindfulness = [99]
        suggestion = ["decompression"]
        professionals = [12.1]
        exchangeHTLC = ["themtopicHTLC":[["decompression":"098"]]]

        duihuaLblHTLC.snp.makeConstraints { make in
            make.leading.trailing.equalToSuperview().inset(16.xHTL)
            make.top.bottom.equalToSuperview().inset(16.xHTL)
        }
    }

    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
